import request from '@/utils/request'

// 查询销售列表
export function listSale(query) {
  return request({
    url: '/sale/sale/list',
    method: 'get',
    params: query
  })
}

// 查询销售详细
export function getSale(saleId) {
  return request({
    url: '/sale/sale/' + saleId,
    method: 'get'
  })
}

// 新增销售
export function addSale(data) {
  return request({
    url: '/sale/sale',
    method: 'post',
    data: data
  })
}

// 修改销售
export function updateSale(data) {
  return request({
    url: '/sale/sale',
    method: 'put',
    data: data
  })
}

// 删除销售
export function delSale(saleId) {
  return request({
    url: '/sale/sale/' + saleId,
    method: 'delete'
  })
}
// 获取编码
export function getCode(code) {
  return request({
    url: '/sale/sale/getcode?code=' + code,
    method: 'post'
  })
}

//查询所有商品
export function selectAllSaleProduct(query) {
  return request({
    url: '/sale/sale/selectAllSaleProduct',
    method: 'post',
    params: query
  })
}
//审核
export function checkbyId(map) {
  return request({
    url: '/sale/sale/check',
    method: 'post',
    data:map
  })
}
//撤销
export function revokebyId(saleId) {
  return request({
    url: '/sale/sale/revoke?saleId='+saleId,
    method: 'post',
  })
}
//查看进货订单详情
export function getInfo(phid) {
  return request({
    url: '/sale/sale/fileInfo?salecode='+phid,
    method: 'post',
  })
}
//关闭单据
export function colseById(saleId) {
  return request({
    url: '/sale/sale/colseById?saleId='+saleId,
    method: 'post',
  })
}
//进货退货单查询进货订单
export function selectSale(data) {
  return request({
    url: '/sale/sale/findSale',
    method: 'post',
    data: data
  })
}

//根据销售单查看累计出库数量和创建时间
export function selectBySaleCode(SaleCode) {
  return request({
    url: '/sale/sale/selectBySaleCode?SaleCode='+SaleCode,
    method: 'get',
  })
}

